// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIContextMenuListener2.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    /// nsIContextMenuListener2
    ///
    /// This is an extended version of nsIContextMenuListener
    /// It provides a helper class, nsIContextMenuInfo, to allow access to
    /// background images as well as various utilities.
    ///
    /// @see nsIContextMenuListener
    /// @see nsIContextMenuInfo
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("7fb719b3-d804-4964-9596-77cf924ee314")]
	public interface nsIContextMenuListener2
	{
		
		/// <summary>
        /// Called when the browser receives a context menu event (e.g. user is right-mouse
        /// clicking somewhere on the document). The combination of flags, along with the
        /// attributes of <CODE>aUtils</CODE>, indicate where and what was clicked on.
        ///
        /// The following table describes what context flags and node combinations are
        /// possible.
        ///
        /// aContextFlags                  aUtils.targetNode
        ///
        /// CONTEXT_LINK                   <A>
        /// CONTEXT_IMAGE                  <IMG>
        /// CONTEXT_IMAGE | CONTEXT_LINK   <IMG> with <A> as an ancestor
        /// CONTEXT_INPUT                  <INPUT>
        /// CONTEXT_INPUT | CONTEXT_IMAGE  <INPUT> with type=image
        /// CONTEXT_TEXT                   <TEXTAREA>
        /// CONTEXT_DOCUMENT               <HTML>
        /// CONTEXT_BACKGROUND_IMAGE       <HTML> with background image
        ///
        /// @param aContextFlags           Flags indicating the kind of context.
        /// @param aUtils                  Context information and helper utilities.
        ///
        /// @see nsIContextMenuInfo
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void OnShowContextMenu(uint aContextFlags, [MarshalAs(UnmanagedType.Interface)] nsIContextMenuInfo aUtils);
	}
	
	/// <summary>nsIContextMenuListener2Consts </summary>
	public class nsIContextMenuListener2Consts
	{
		
		// <summary>
        //Flag. No context. </summary>
		public const ulong CONTEXT_NONE = 0;
		
		// <summary>
        //Flag. Context is a link element. </summary>
		public const ulong CONTEXT_LINK = 1;
		
		// <summary>
        //Flag. Context is an image element. </summary>
		public const ulong CONTEXT_IMAGE = 2;
		
		// <summary>
        //Flag. Context is the whole document. </summary>
		public const ulong CONTEXT_DOCUMENT = 4;
		
		// <summary>
        //Flag. Context is a text area element. </summary>
		public const ulong CONTEXT_TEXT = 8;
		
		// <summary>
        //Flag. Context is an input element. </summary>
		public const ulong CONTEXT_INPUT = 16;
		
		// <summary>
        //Flag. Context is a background image. </summary>
		public const ulong CONTEXT_BACKGROUND_IMAGE = 32;
	}
	
	/// <summary>
    /// nsIContextMenuInfo
    ///
    /// A helper object for implementors of nsIContextMenuListener2.
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("2f977d56-5485-11d4-87e2-0010a4e75ef2")]
	public interface nsIContextMenuInfo
	{
		
		/// <summary>
        /// The DOM context menu event.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDOMEvent GetMouseEventAttribute();
		
		/// <summary>
        /// The DOM node most relevant to the context.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDOMNode GetTargetNodeAttribute();
		
		/// <summary>
        /// Given the <CODE>CONTEXT_LINK</CODE> flag, <CODE>targetNode</CODE> may not
        /// nescesarily be a link. This returns the anchor from <CODE>targetNode</CODE>
        /// if it has one or that of its nearest ancestor if it does not.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetAssociatedLinkAttribute([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase aAssociatedLink);
		
		/// <summary>
        /// Given the <CODE>CONTEXT_IMAGE</CODE> flag, these methods can be
        /// used in order to get the image for viewing, saving, or for the clipboard.
        ///
        /// @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no
        /// image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there
        /// is an image, but for some reason it cannot be returned.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		imgIContainer GetImageContainerAttribute();
		
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIURI GetImageSrcAttribute();
		
		/// <summary>
        /// Given the <CODE>CONTEXT_BACKGROUND_IMAGE</CODE> flag, these methods can be
        /// used in order to get the image for viewing, saving, or for the clipboard.
        ///
        /// @return <CODE>NS_OK</CODE> if successful, otherwise <CODE>NS_ERROR_FAILURE</CODE> if no background
        /// image was found, or NS_ERROR_NULL_POINTER if an internal error occurs where we think there is a
        /// background image, but for some reason it cannot be returned.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		imgIContainer GetBackgroundImageContainerAttribute();
		
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIURI GetBackgroundImageSrcAttribute();
	}
}
